Skip to content

Reject abandoned branch hashes - #14

Open
Frozen wants to merge 1 commit into
mainfrom
fix/reject-abandoned-branch-hashes
Open

Reject abandoned branch hashes#14
Frozen wants to merge 1 commit into
mainfrom
fix/reject-abandoned-branch-hashes

Conversation

@Frozen

@Frozen Frozen commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • reject the first abandoned shard 0 child at block 92,730,035 by exact hash
  • keep the known malicious shard 0 block 92,730,036 and shard 1 block 94,978,279 rejected by exact hash
  • enforce rejection before FBFT caching/PREPARE and before header, signature, body, receipt-chain, epoch-chain, head, TiKV, and off-chain writes
  • reject embedded references to denied hashes in beacon crosslinks and incoming CX receipt source headers
  • leave rollback, emergency recovery, and staged sync unchanged

This copies only the abandoned-branch rejection from #13. PR #13 itself is unchanged.

[Test]

  • gofmt and goimports on changed Go files
  • go test -mod=readonly ./consensus/engine ./internal/chain ./consensus ./core
  • go vet -mod=readonly ./consensus/engine ./internal/chain ./consensus ./core
  • git diff --check

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

The PR introduces a centralized exact-hash denylist for three abandoned or malicious blocks and applies it across consensus validation, header and crosslink verification, block insertion, epoch synchronization, receipt-chain processing, head updates, TiKV forwarding, and off-chain persistence.

  • Rejects denied hashes before FBFT caching and PREPARE.
  • Rejects direct block/header hashes and embedded beacon crosslinks or incoming receipt source headers.
  • Adds focused tests for consensus, engine, core persistence, and crosslink verification paths.

Confidence Score: 5/5

The PR appears safe to merge; the denylist is consistently enforced before the relevant consensus acceptance and persistence boundaries.

The changed paths reject direct and embedded denied hashes before caching, signature acceptance, canonical-head updates, or database writes, and no reachable bypass or regression remains.

Important Files Changed

Filename Overview
consensus/engine/rejected_block.go Defines the shared rejection error, exact denylist, and hash-validation helper.
consensus/validator.go Enforces rejection before FBFT logging, PREPARE signing, and verified-block cache shortcuts.
core/rejected_block.go Extends rejection to block hashes, decoded crosslinks, and incoming receipt source headers.
internal/chain/engine.go Rejects denied headers and crosslinks before signature verification or signature-cache use.
core/blockchain_impl.go Adds rejection gates to receipt import, block writes, head changes, TiKV forwarding, and chain insertion.
core/epochchain.go Prevents denied blocks from entering epoch-chain insertion and head-update paths.
core/offchain.go Prevents off-chain receipt and crosslink writes for blocks containing denied references.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming block or FBFT message] --> B{Exact block hash denied?}
    B -- Yes --> X[Return ErrRejectedBlock]
    B -- No --> C{Embedded crosslink hash denied?}
    C -- Yes --> X
    C -- No --> D{Incoming receipt source hash denied?}
    D -- Yes --> X
    D -- No --> E[Continue signature and semantic validation]
    E --> F[Consensus cache or persistence paths]
Loading

Reviews (1): Last reviewed commit: "fix: reject abandoned branch hashes" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant